<!DOCTYPE html>
<html lang="en">

<head>
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <meta http-equiv="Content-Language" content="UTF-8">
    <style type="text/css">
        body,
        div,
        p,
        ul,
        li,
        span {
            margin: 0px;
            padding: 0px;
        }

        .page {
            width: 600px;
            height: 348px;
            background-color: #FFFFFF;
            border: 1px solid #cccccc;
            margin: auto;
        }

        .main {
            width: 540px;
            margin: auto;
        }

        .main p {
            color: #000000;
            font-size: 16px;
            margin: 10px 0px 5px 0px
        }

        .content {
            margin: 0;
            padding: 0;
            border-top: 1px solid #cccccc;
        }

        ul,
        li,
        span {
            list-style: none outside;
        }

        .blue-btn {
            font-size: 15px;
            display: block;
            cursor: pointer;
            text-align: center;
            width: 70px;
            height: 30px;
            line-height: 30px;
            text-decoration: none;
            border: 1px solid #ccc;
            background-color: #eff2f4;
            color: #000;
        }

        .input:focus {
            border: 1px solid #76C2EA;
        }

        .input {
            line-height: 28px;
            width: 200px;
            height: 28px;
            border: 1px solid #cccccc;
        }

        .clearfloat:after {
            display: block;
            clear: both;
            content: "";
            visibility: hidden;
            height: 0;
        }

        .clearfloat {
            zoom: 1
        }

        .box {
            width: 100%;
            height: 40px;
            line-height: 40px;
            margin-top: 30px;
            margin-bottom: 30px;
        }

        .box li {
            display: inline;
        }

        #reasonDesc {
            margin-left: 20px;
            border-style: none none solid;
            border-width: medium medium 1px;
            display: inline;
            font-size: 15px;
            height: 16px;
            width: 300px;
            line-height: 16px;
        }

        #msg_tip {
            margin-left: -299px;
            display: none;
            color: rgb(192, 197, 200);
            height: 18px;
            line-height: 18px;
        }

        .button {

            margin-top: 20px
        }

        .ok {
            display: inline-block;
            float: left;
            margin-left: 172px;
        }

        .cancel {
            display: inline-block;
            float: left;
            margin-left: 10px;
        }

        .button a {
            width: 85px;
        }
    </style>
</head>

<body>
    <div id="page" class="page">
        <div id="main" class="main">
        </div>
    </div>
</body>
<script type="text/javascript">
    function t(text, obj) {
        if (window.__i18n__) {
            try{
                var json = window.__i18n__.resources[window.__i18n__.locale]['translation']
                if(obj){
                    for(var key in obj){
                        var reg = new RegExp("{{" + key + "}}");
                        json[text] = json[text].replace(reg, obj[key])
                    }
                    return json[text]
                }else{
                    return json[text]
                }
            }catch(err){}
        } else {
            return text
        }
    }
    document.title= t(window.__COMPANY_INFO_i18n_key.title)

    window.onload = function () {
        /**
         * 获取请求参数
         * @param {*} param
         * @returns
         */
        function getUrlParam(param) {
            var reg = new RegExp("(^|&)" + param + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substring(1).match(reg); //匹配目标参数
            if (r != null) return decodeURI(r[2]);
            return null; //返回参数值
        }
        var htmlStr = '<p>' + t('提示') + '</p>' +
            '<div class="content">' +
            '</div>' +
            '<div>' +
            '<ul class="box clearfloat">' +
            '<div class="">' + t('请选择您不通过该会议的原因：') + '</div>' +
            '<div><input type="radio" name="reasonId" checked="checked" value="1" id="defaultReason1" />' + t(
                '会议时间冲突') +
            '</div>' +
            '<div><input type="radio" name="reasonId" value="2" id="defaultReason2" />' + t('会议室资源紧张') + '</div>' +
            '<div><input type="radio" name="reasonId" value="3" id="defaultReason3" />' + t('视频会议资源紧张') + '</div>' +
            '<div>' +
            '<li><input type="radio" name="reasonId" value="0" id="unDefaultReason" />' + t('其他') + '</li>' +
            '<li><input id="reasonDesc" class="input" type="text" value="" />' +
            '</li>' +
            '<span id="msg_tip">' + t('请输入原因') + '</span>' +
            '</div>' +
            '<div class="button">' +
            '<div class="ok"><a id="sub_no" class="blue-btn">' + t('确认') + '</a></div>' +
            '<div class="cancel"><a id="sub_cancel" class="blue-btn">' + t('取消') + '</a></div>' +
            '</div>' +
            '</ul>' +
            '</div>'

        document.getElementById('main').innerHTML = htmlStr
        var state, meetingMoid, participantor
        meetingMoid = getUrlParam('meetingMoid')
        participantor = getUrlParam('participantor')
        state = getUrlParam('state')

        if (state == "false") {
            document.getElementById("page").style.display = "none";
            alert(t("请求发生异常!") );
        } else { //请求正常
            window.data = {
                meetingMoid: meetingMoid,
                participantor: participantor
            };
            window.meeting = {};
            window.meeting.notify = {
                // pageContext.request.contextPath
                M_URL: "/meetingFeedback/auditMeeting?meetingMoid=" + data.meetingMoid +
                    "&feedback=0" +
                    "&participantor=" + data.participantor,
                init: function () {
                    var reasonDesc = this.getById("reasonDesc");
                    reasonDesc.style.display = "none";
                    reasonDesc.value = "";
                    this.event();
                },
                getById: function (id) {
                    return document.getElementById(id);
                },
                getByChoose: function (name) {
                    var reasonId = "";
                    var reasonlist = document.getElementsByName(name);
                    for (i = 0; i < reasonlist.length; i++) {
                        if (reasonlist[i].checked)
                            reasonId = reasonlist[i].value;
                    }
                    return reasonId;
                },
                event: function () {
                    var that = this;
                    var sub = this.getById("sub_no");
                    var page = this.getById("page");
                    var reasonDesc = this.getById("reasonDesc");
                    var defaultReason1 = this.getById("defaultReason1");
                    var defaultReason2 = this.getById("defaultReason2");
                    var defaultReason3 = this.getById("defaultReason3");
                    var unDefaultReason = this.getById("unDefaultReason");
                    var cancel = this.getById("sub_cancel");
                    var msgTip = this.getById("msg_tip");
                    sub.onclick = function () {
                        var reasonDesc = that.getById("reasonDesc");
                        var reasonId = that.getByChoose("reasonId");

                        var system_url = window.location.pathname.indexOf('/meetingCore') > -1 ?
                            '/meetingapicoreweb' : '/meetingapiweb';


                        if (reasonId != "0") {
                            window.open(system_url + that.M_URL + "&descType=" + reasonId, "_self");
                        } else {
                            var temp = reasonDesc.value;
                            reasonDesc.value = temp.replace(/(^\s+)|(\s+$)/g, "");
                            if (reasonDesc.value == "") {
                                alert(t("不通过会议原因不能为空") );
                                msgTip.style.display = "inline-block";
                                return;
                            } else if (reasonDesc.value.length > 40) {
                                alert(t("最多可输入40个字符"));
                                reasonDesc.focus();
                                return;
                            }
                            window.open(system_url + that.M_URL + "&descType=" + reasonId + "&desc=" +
                                encodeURIComponent(reasonDesc.value), "_self");
                        }


                    };
                    var selectreasonDesc = function () {
                        reasonDesc.style.outline = "none";
                        msgTip.style.display = "none";
                        reasonDesc.focus();
                    };
                    reasonDesc.onclick = selectreasonDesc;
                    msgTip.onclick = selectreasonDesc;
                    cancel.onclick = function () {
                        page.style.display = "none";
                        // window.close();
                        if (navigator.userAgent.indexOf('MSIE') > 0) {
                            // close IE
                            if (navigator.userAgent.indexOf('MSIE 6.0') > 0) {
                                window.opener = null
                                window.close()
                            } else {
                                window.open('', '_top')
                                window.top?.close()
                            }
                        } else {
                            // close chrome;It is effective when it is only one.
                            window.opener = null
                            window.open('', '_self')
                            window.close()
                        }
                    };
                    defaultReason1.onclick = function () {
                        reasonDesc.style.display = "none";
                        msgTip.style.display = "none";
                    };
                    defaultReason2.onclick = function () {
                        reasonDesc.style.display = "none";
                        msgTip.style.display = "none";
                    };
                    defaultReason3.onclick = function () {
                        reasonDesc.style.display = "none";
                        msgTip.style.display = "none";
                    };
                    unDefaultReason.onclick = function () {
                        reasonDesc.value = "";
                        reasonDesc.style.display = "inline-block";
                        msgTip.style.display = "inline-block";
                    };
                }
            }; //对象结束
            window.meeting.notify.init();
        }
    }

</script>


</html>
